<template>
  <div class="viewDetail">
    <el-button type="buttom" @click="formVisible = true;viewDetail()" :style="{padding:'9px',fontSize:'12px',float:'left',marginRight:'10px'}">查看</el-button>
    <el-dialog title="详情信息" :visible.sync=" formVisible" center>
      <el-form :model="form">
        <el-form-item label="背景图描述" >
          <el-input v-model="form.describe" autocomplete="off" :style="{width:'88%'}"></el-input>
        </el-form-item>
        <el-form-item label="背景图图片" >
           <el-upload
              disabled
              class="avatar-uploader"
              action="https://jsonplaceholder.typicode.com/posts/"
              :show-file-list="false">
              <img v-if="form.imageUrl" :src="form.imageUrl" class="avatar" :style="{width:'50%',height:'50%'}">
              <i v-else class="el-icon-plus avatar-uploader-icon"></i>
            </el-upload>
        </el-form-item>
        <el-form-item label="图片地址" >
          <el-input v-model="form.imageUrl" autocomplete="off" :style="{width:'88%'}"></el-input>
        </el-form-item>
      </el-form>
    </el-dialog>
  </div>
</template>
<script>
export default {
  data() {
    return {
      form: {
        id: '',
        describe: '',
        imageUrl: '',
      },
      formVisible: false,
    }
  },
  props: {
    detail: Object,
  },
  methods: {
    onSubmit() {
      console.log(1234567890)
    },
    submitUpload() {
      console.log('上传图片')
    },

    // 点击查看按钮查看详情
    viewDetail() {
      this.form = this.detail
      this.form.describe = this.detail.title
      this.form.imageUrl = this.detail.mageUrl
    },
  },
}
</script>
<style lang="less" scoped>

/deep/.el-upload{
  border: 0 !important;
}
/deep/ .el-button--small{
  padding: 0 ;
}
/deep/.avatar-uploader .el-upload {
    border: 1px dashed #d9d9d9;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
  }
  /deep/.avatar-uploader .el-upload:hover {
    border-color: #409EFF;
  }
  /deep/.avatar-uploader-icon {
    font-size: 28px;
    color: #8c939d;
    width: 178px;
    height: 178px;
    line-height: 178px;
    text-align: center;
  }
  /deep/.avatar {
    width: 178px;
    height: 178px;
    display: block;
  }
</style>
